﻿using StarPizza.Model.BaseModel;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace StarPizza.ViewModel.Core
{
    public class DoughVM : IngredientVM
    {
        Dough dough;
        public Dough WrappedDough { get { return dough; } }
        public DoughVM(Dough dough)
            : base(ingredient: dough)
        {
            this.dough = dough;
            dough.PropertyChanged += dough_PropertyChanged;
        }

        //Forward accessor
        public int Size
        {
            get { return dough.Size; }
        }
        void dough_PropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            switch (e.PropertyName)
            {
                case "Size":
                    OnPropertyChanged("DescriptionForClient");
                    break;
                //all the other cases are handled by the base IngredientVM
            }
        }
        public string DescriptionForClient
        {
            get { return Size + " cm - " + Price + " Ft"; }
        }

        public override void UpdateModel()
        {
            base.UpdateModel();
            OnPropertyChanged("DescriptionForClient");
        }
    }
}
